//*************************************************************************//
//*           _____   ____________            ______               __     *//
//*          / /__ \ / ____/ ____/           / ____/___  _________/ /     *//
//*     __  / /__/ // __/ / __/    ______   / /_  / __ \/ ___/ __  /      *//
//*    / /_/ // __// /___/ /___   /_____/  / __/ / /_/ / /  / /_/ /       *//
//*    \____//____/_____/_____/           /_/    \____/_/   \__,_/        *//
//*                                                                       *//
//*     Copyright (c) 2006 Ford Argentina. All Rights Reserved.           *//
//*                                                                       *//
//*************************************************************************//

package ar.com.ford.it.webengine.struts;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMessages;
import ar.com.ford.it.webengine.websession.WebSession;
import com.ford.it.logging.ILogger;
import com.ford.it.logging.Level;
import com.ford.it.logging.LogFactory;

public class LogoutAction extends AbstractBaseAction {
	private static final String CLASS_NAME = LogoutAction.class.getName();
	private static final ILogger log = LogFactory.getInstance().getLogger(CLASS_NAME);
	
	public ActionForward initPage(FordActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, WebSession websession, ActionMessages msgs, ActionMessages warns, ActionMessages errormsgs) {
		String METHOD_NAME = "initPage";
		log.entering(CLASS_NAME, METHOD_NAME);

		log.logp(Level.FINE, CLASS_NAME, METHOD_NAME, "Cerrando session", websession.getUser().getId());
			
		request.getSession().invalidate();
		
		log.exiting(CLASS_NAME, METHOD_NAME);
		return mapping.findForward("success");
	}

}
